package com.itsv.cyzx.util;

import com.itsv.xhyy.R;

import android.content.Context;
import android.content.pm.PackageManager.NameNotFoundException;
import android.telephony.TelephonyManager;
import android.util.Log;

public class UpdateUtil {

	private static final String TAG = "Config";

	public static final String UPDATE_VERJSON = "app.service.do?m=getVersion&appName=cyzx";

	public static int getVerCode(Context context) {
		int verCode = -1;
		try {
			verCode = context.getPackageManager().getPackageInfo(
					context.getPackageName(), 0).versionCode;
		} catch (NameNotFoundException e) {
			Log.e(TAG, e.getMessage());
		}
		return verCode;
	}

	public static String getVerName(Context context) {
		String verName = "";
		try {
			verName = context.getPackageManager().getPackageInfo(
					context.getPackageName(), 0).versionName;
		} catch (NameNotFoundException e) {
			Log.e(TAG, e.getMessage());
		}
		return verName;

	}

	public static String getAppName(Context context) {
		String verName = context.getResources().getText(R.string.app_name_en)
				.toString();
		return verName;
	}

	public static String getIMEI(Context con) {
		return ((TelephonyManager) con.getSystemService(con.TELEPHONY_SERVICE))
				.getDeviceId();
	}
}
